// 导入组件
import Vue from 'vue';
import Router from 'vue-router';
// 登录
import login from '@/views/login';
// 首页
import index from '@/views/index';
import User from "../views/group/User";

import UserInfo from "../views/group/UserInfo";
import Device_index from "../views/device_back/Device_index";
import device from "../views/device/device";

import devicefl from "../views/device/devicefl.vue";

import deviceLogType from "../views/deviceLog/deviceLogType";
import deviceLog from "../views/deviceLog/deviceLog";
import sysLog from "../views/deviceLog/sysLog";
import taskLog from "../views/deviceLog/taskLog";
import errorLog from "../views/deviceLog/errorLog";



import repair from "../views/repair/repair";
import repair_depart from "../views/repair/repair_depart";
import repair_status from "../views/repair/repair_status";
import repair_addr from "../views/repair/repair_addr";
import repair_urgency from "../views/repair/repair_urgency";




import Order from "../views/logistics/Order";
import Part from "../views/logistics/Part";


import fault from "../views/fault/fault.vue";
import fault_mag from "../views/fault/fault_mag.vue";





/**
 * 基础菜单
 */

// 启用路由
Vue.use(Router);

// 导出路由
export default new Router({
  routes: [
    {
      path: '/', // 访问根路径 ===就是访问login组件
      name: '',
      component: login,
      hidden: true,
      meta: {
        requireAuth: false   //访问 /路径是否需要权限
      }
    },
    {
      path: '/login', // 匹配login 路径
      name: '登录',
      component: login,
      hidden: true,
      meta: {
        requireAuth: false
      }
    },
    {
      path: '/index',  // 匹配index路径
      name: '首页',
      component: index,
      iconCls: 'el-icon-tickets',
      children: [    //配置子路由
        // 个人中心
        {
          path: 'user/info',
          component: UserInfo,
          meta: {
            requireAuth: false
          },
        },
        //首页管理
        {
          path: 'device_back/device_index',
          name: 'Device_index',
          component: Device_index,
          meta: {
            requireAuth: true
          }
        },
        // 用户模块
        {
          path: 'group/user',
          name: 'User',
          component: User,
          meta: {
            requireAuth: true
          }
        },

        // 故障模块
        {
          path: 'fault/fault',
          name: 'fault',
          component: fault,
          meta: {
            requireAuth: true
          },
        },
        // 故障统计
        {
          path: 'fault/fault_mag',
          name: 'fault1',
          component: fault_mag,
          meta: {
            requireAuth: true
          },
        },
        //设备信息管理

        //设备模块

        {
          path: 'device/device',
          name: 'device',
          component: device,
          meta: {
            requireAuth: true
          }

        },
        {
          path: 'devicefl/devicefl',
          name: 'devicefl',
          component: devicefl,
          meta: {
            requireAuth: true
          }
        },


        //日志信息模块
        {
          path: 'deviceLog/deviceLog',
          name: 'deviceLog',

          component: deviceLog,
          meta: {
            requireAuth: true
          }
},


        {
          path: 'repair/repair',
          name: 'repair',
          component: repair,

          meta: {
            requireAuth: true
          }
        },

        //日志类型模块
        {
          path: 'deviceLog/deviceLogType',
          name: 'deviceLogType',

          component: deviceLogType,
          meta: {
            requireAuth: true
          }},

        {
          path: 'repair/repair_depart',
          name: 'repair_depart',
          component: repair_depart,
          meta: {
            requireAuth: true
          }
        },

        //系统日志
        {
          path: 'deviceLog/sysLog',
          name: 'sysLog',

          component: sysLog,
          meta: {
            requireAuth: true
          }},
        {
          path: 'repair/repair_status',
          name: 'repair_status',
          component: repair_status,

          meta: {
            requireAuth: true
          }
        },

        //任务日志
        {
          path: 'deviceLog/taskLog',
          name: 'taskLog',

          component: taskLog,
          meta: {
            requireAuth: true
          }},
        {
          path: 'repair/repair_addr',
          name: 'repair_addr',
          component: repair_addr,
          meta: {
            requireAuth: true
          }
        },

        //错误日志
        {
          path: 'deviceLog/errorLog',
          name: 'errorLog',

          component: errorLog,
          meta: {
            requireAuth: true
          }},
        {
          path: 'repair/repair_urgency',
          name: 'repair_urgency',
          component: repair_urgency,

          meta: {
            requireAuth: true
          }
        },

        {
          path: 'logistics/Order',
          name: 'Order',
          component: Order,
          meta: {
            requireAuth: true
          }
        },
        {
          path: 'logistics/Part',
          name: 'Part',
          component: Part,
          meta: {
            requireAuth: true
          }
        },
      ]
    },
  ]
})
